<template>
  <q-page class="cc-admin">

    <div class="col bg-white shadow-2 q-pa-md q-ma-sm">
      <q-table flat color="primary" class="cross_table" separator="cell" :columns="columns" :data="list" row-key="id" :pagination.sync="pagination" :visible-columns="group" @request="query" :rows-per-page-options="[10, 20, 50, 100]" selection="multiple" :selected.sync="selected">

        <!-- <template v-slot:top="table">
          <div class="row no-wrap full-width">
            <q-input clearable outlined dense placeholder="请输入关键字搜索" class="on-left" @input="query" debounce="500" v-model="key">
              <template #append>
                <q-btn flat round icon="search" color="primary" @click="query" :loading="loading">
                  <q-tooltip>搜索</q-tooltip>
                </q-btn>
              </template>
            </q-input>
            <q-space />
            <table-top-btns label="平台轨迹" modelName="platformLocation" :showAdd="true" :table="table" :selected="selected" :importing="importing" :exporting="exporting" :importExcelUrlFull="importExcelUrlFull" :columns="columns" @groupChange="groupChange" @add="add" @importExcel="importExcel" @exportExcel="exportExcel"
              @showConfirm="showConfirm" />
          </div>
        </template> -->
        <template #body-cell-opt="props">
          <q-td :props="props" :auto-width="true">
            <q-btn flat round dense color="primary" icon="edit" @click="edit(props.row)"> <q-tooltip>编辑</q-tooltip></q-btn>
            <q-btn flat round dense color="primary" icon="mdi-content-copy" @click="copy(props.row)">
              <q-tooltip>复制</q-tooltip>
            </q-btn>
            <btn-del label="平台轨迹" @confirm="del(props.row)" />
          </q-td>
        </template>
      </q-table>
    </div>
    <q-dialog maximized flat persistent ref="dialog">
      <q-form @submit="submit" class="dialog_card column">
        <h5 class="view_title justify-between q-px-md">
          {{ editType }}平台轨迹
          <q-btn dense outline round icon="clear" size="sm" v-close-popup />
        </h5>
        <q-scroll-area class="col">
          <div class="row q-col-gutter-x-md dialog_form q-pa-md">
            <div class="col-12">
              <h5> 编号：</h5>
              <q-input outlined dense v-model="form.id" type="text" />
            </div>
            <div class="col-12">
              <h5> mmsi：</h5>
              <q-input outlined dense v-model="form.mmsi" type="text" />
            </div>
            <div class="col-12">
              <h5> 经度：</h5>
              <q-input outlined dense v-model="form.lon" type="text" />
            </div>
            <div class="col-12">
              <h5> 纬度：</h5>
              <q-input outlined dense v-model="form.lat" type="text" />
            </div>
            <div class="col-12">
              <h5> 速度：</h5>
              <q-input outlined dense v-model="form.speed" type="text" />
            </div>
            <div class="col-12">
              <h5> 向：</h5>
              <q-input outlined dense v-model="form.direction" type="text" />
            </div>
            <div class="col-12">
              <h5> 航迹向：</h5>
              <q-input outlined dense v-model="form.course" type="text" />
            </div>
            <div class="col-12">
              <h5> 航行状态：</h5>
              <q-input outlined dense v-model="form.status" type="text" />
            </div>
            <div class="col-12">
              <h5> 时间戳：</h5>
              <q-input outlined dense v-model="form.receiveDate" type="text" />
            </div>
          </div>
        </q-scroll-area>
        <div class="row justify-center q-pa-md">
          <q-btn outline color="primary" icon="mdi-close-thick" label="关闭" v-close-popup />
          <q-btn class="q-mx-md" color="primary" icon="mdi-check-bold" label="提交" :loading="loading" type="submit" />
        </div>
      </q-form>
    </q-dialog>
    <confirm ref="confirmDialog" :msg="confirmMsg" @confirm="deleteBatch()" />
    <q-inner-loading :showing="loading">
      <q-spinner-gears size="50px" color="primary" />
    </q-inner-loading>
  </q-page>
</template>

<script>
import { IndexMixin } from 'boot/mixins';
import { getDictLabel } from 'boot/dictionary';
import confirm from 'components/confirm';

export default {
  name: 'WeaPlatformLocation',
  mixins: [IndexMixin],
  components: {
    confirm,
  },
  data() {
    return {
      columns: [
        {
          name: 'index',
          align: 'center',
          label: '序号',
          field: 'index',
        },
        {
          name: 'id', align: 'left', label: '编号', field: 'id',
        },
        {
          name: 'mmsi', align: 'left', label: 'mmsi', field: 'mmsi',
        },
        {
          name: 'lon', align: 'left', label: '经度', field: 'lon',
        },
        {
          name: 'lat', align: 'left', label: '纬度', field: 'lat',
        },
        {
          name: 'speed', align: 'left', label: '速度', field: 'speed',
        },
        {
          name: 'direction', align: 'left', label: '向', field: 'direction',
        },
        {
          name: 'course', align: 'left', label: '航迹向', field: 'course',
        },
        {
          name: 'status', align: 'left', label: '航行状态', field: 'status',
        },
        {
          name: 'receiveDate', align: 'left', label: '时间戳', field: 'receiveDate',
        },
        // {
        //   name: 'opt', align: 'center', label: '操作', field: 'id',
        // },
      ],
      showQuery: true,
      headers: [{ name: 'Authorization', value: localStorage.Authorization }],
      uploadUrl: `${process.env.SERVER_URL}${process.env.BASE_URL}/sys/common/upload`,
      imgUrl: `${process.env.SERVER_URL}${process.env.BASE_URL}/sys/common/static`,
      url: {
        list: '/wea/platformLocation/list',
        add: '/wea/platformLocation/add',
        edit: '/wea/platformLocation/edit',
        copy:
          '/wea/platformLocation/copy',
        delete: '/wea/platformLocation/delete',
        deleteBatch: '/wea/platformLocation/deleteBatch',
        exportXlsUrl: '/wea/platformLocation/exportXls',
        importExcelUrl: '/wea/platformLocation/importExcel',
      },
    };
  },
  methods: {
    getDictLabel,
    initDict() {
    },
  },
  mounted() {
    this.initDict();
  },
};
</script>

<style lang="stylus">

</style>
